package com.haonan.pojo.entily;

import jdk.jfr.DataAmount;
import lombok.Data;

import java.io.Serializable;

@Data
public class Result implements Serializable {
    private Integer code;  ////编码：1成功，0为失败
    private String msg;  //返回描述
    private Object data;  //返回响应后的数据
    //响应成功,并无数据返回
    public static Result success(){
        Result r=new Result();
        r.setCode(1);
        r.setMsg("success");
        return r;
    }
    //响应成功，有数据返回
    public static Result success(Object data){
        Result r=new Result();
        r.setCode(1);
        r.setMsg("success");
        r.setData(data);
        return r;
    }
    //响应失败，无数据返回
    public static Result error(String msg){
        Result r=new Result();
        r.setCode(0);
        r.setMsg(msg);
        return r;
    }

}
